﻿# -*- codeing = utf-8 -*-
# @Time: 2021/10/24 21:38
# @Author: Ivan
# @File: 19-异常.py
# @Software: PyCharm

# try:
#     num = int(input('请输入数字：'))
#     print(num)
# except ValueError:
#     print('请输入正确的数字...')
# except Exception as result:
#     print('未知错误：%s' % result)
# else:
#     print('else代码没有异常时会执行...')
# finally:
#     print('finally代码总会执行...')


# 异常传递，只需要在最外层处理异常即可
def demo1():
    raise Exception('主动抛出异常')
    return int(input('请输入数字：'))

def demo2():
    return demo1()

print(demo2())

